import React, { Component } from 'react'
import axios from 'axios'
import '../../assets/css/detail/k-content.less'

export default class KContent extends Component {
    constructor(props) {
        super(props)
        console.log(this.props.id);
        this.state = {
            data: {}
        }
    }
    render() {
        return (
            <div className="k-content">
                <h2>{this.state.data.title}</h2>
                <ul>
                    <li>{this.state.data.author}</li>
                    <li>{this.state.data.createTime}</li>
                </ul>
                <div className="article" dangerouslySetInnerHTML={{ __html: this.state.data.content }}>
                </div>
            </div>
        )
    }
    async componentDidMount() {
        const { data } = await axios.get('/data/artiles.json')
        this.setState({
            data: data[0]
        })
    }
}
